<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .btn {
      background-color: transparent;
      border-radius: 5px;
      cursor: pointer;
      border: 2px solid purple;
      color: purple;
      padding: 10px 20px;
      font-weight: bold;
      position: relative;
      transition: all 1s;
      overflow: hidden;
    }

    .btn::before {
      content: '';
      display: block;
      height: 100%;
      width: 0%;
      background-color: purple;
      position: absolute;
      left: -30px;
      top: 0;
      transform: skewX(45deg);
      transition: all 1s;
      z-index: -1;
    }
    
    .btn:hover::before {
      width: 160%;
    }
    .btn:hover {
      color: white;
    }
  </style>
</head>
<body>

<button class="btn">
  悬浮动画
</button>
  
</body>
</html>